<?php
/**
 * Created by PhpStorm.
 * User: 15814
 * Date: 2018/10/11
 * Time: 17:31
 */

include "config.php";
if (isset($_POST["userId"]) && isset($_POST["pid"]) && isset($_POST["num"]))
{
    $sql="UPDATE `goodsinfo` SET `gNum`=?,`gtoal`=`gNum`*`gPrice` WHERE uId=? AND gId=? ;";
    $ready=$conn->prepare($sql);
    $ready->bind_param("iii",$_POST["num"],$_POST["userId"],$_POST["pid"]);
    $ready->execute();
    if ($ready->affected_rows>=1){
        print_r(json_encode(array("stu"=>1,"msg"=>"修改成功")));
    }
    else{
        print_r(json_encode(array("stu"=>0,"msg"=>"修改失败")));
    }

}